/*
* ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
* Without permission, no one has the right to obtain, disclose or use this software in any way.
*/

package ecarx.xsf.notificationcenter.scenecard;

import android.app.PendingIntent;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * FileName: IPendingIntentAction.java <br>
 * Description : 智能卡片数据动作事件 <br>
 * Create Time: 2021/8/3 14:07 <br>
 * Update Time: 2021/8/3 14:07 <br>
 *
 * @since 1.0.0
 */
public class IPendingIntentAction implements Parcelable {

    /**
     * 操作事件的 id
     */
    private int id;

    /**
     * 操作事件文本，如 Button 的标题，可见即可说的内容
     */
    private String text;

    /**
     * 按钮的背景资源
     */
    private String bgUrl;

    /**
     * 场景事件功能 id, 默认由场景引擎管理
     */
    private String functionId;

    /**
     * 响应事件
     */
    private PendingIntent pendingIntent;

    public IPendingIntentAction() {
    }


    public IPendingIntentAction(int id, String text, String bgUrl, String functionId, PendingIntent pendingIntent) {
        this.id = id;
        this.text = text;
        this.bgUrl = bgUrl;
        this.functionId = functionId;
        this.pendingIntent = pendingIntent;
    }


    protected IPendingIntentAction(Parcel in) {
        id = in.readInt();
        text = in.readString();
        bgUrl = in.readString();
        functionId = in.readString();
        pendingIntent = in.readParcelable(PendingIntent.class.getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(text);
        dest.writeString(bgUrl);
        dest.writeString(functionId);
        dest.writeParcelable(pendingIntent, flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<ecarx.xsf.notificationcenter.scenecard.IPendingIntentAction> CREATOR = new Creator<ecarx.xsf.notificationcenter.scenecard.IPendingIntentAction>() {
        @Override
        public ecarx.xsf.notificationcenter.scenecard.IPendingIntentAction createFromParcel(Parcel in) {
            return new ecarx.xsf.notificationcenter.scenecard.IPendingIntentAction(in);
        }

        @Override
        public ecarx.xsf.notificationcenter.scenecard.IPendingIntentAction[] newArray(int size) {
            return new ecarx.xsf.notificationcenter.scenecard.IPendingIntentAction[size];
        }
    };

    public String getFunctionId() {
        return functionId;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setText(String text) {
        this.text = text;
    }

    public void setBgUrl(String bgUrl) {
        this.bgUrl = bgUrl;
    }

    public void setPendingIntent(PendingIntent pendingIntent) {
        this.pendingIntent = pendingIntent;
    }

    public String getText() {
        return text;
    }

    public String getActionBgUrl() {
        return bgUrl;
    }

    public PendingIntent getPendingIntent() {
        return pendingIntent;
    }
}
